import { defineStore } from 'pinia'

export const useSystemStore = defineStore({
    id: 'app-system',
    state: (): SystemStore => {
        return {
            locale: null
        }
    },
    getters: {
        currentLocale: state => state.locale || 'zh-CN'
    },
    actions: {
        updateLocale(locale: 'zh-CN' | 'en-US') {
            this.locale = locale
        }
    },
    persist: {
        enabled: true,
        strategies: [{ storage: localStorage }]
    }
})
